package com.cictec.middleware.gps;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import com.cictec.middleware.gps.engine.position.handler.BusPositionAlarmsHandler;
import com.cictec.middleware.gps.service.BusLineService;
import com.cictec.middleware.gps.service.DeviateService;
import com.cictec.middleware.gps.service.ScheduleService;

@Component
public class InitDataService implements ApplicationContextAware{

	@Autowired
	private DeviateService deviateService;
	@Autowired
	private ScheduleService scheduleService;
	@Autowired
	private BusLineService busLineService;
	@Autowired
	private BusPositionAlarmsHandler busPositionAlarmsHandler;


	private void initData(){
		deviateService.init();
//		scheduleService.init();
		busPositionAlarmsHandler.init();
		busLineService.loadBusLineInfo();
	}
	
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		initData();
		
	}
}
